/*
https://leetcode-cn.com/problems/generate-random-point-in-a-circle/solution/zai-yuan-nei-sui-ji-sheng-cheng-dian-by-leetcode/
 */
import java.util.Arrays;

public class Solution478 {

    double radius;
    double x_center;
    double y_center;

    public Solution478(double radius, double x_center, double y_center) {
        this.radius=radius;
        this.x_center=x_center;
        this.y_center=y_center;
    }

    public double[] randPoint() {
        double r=Math.sqrt(Math.random())*radius;
        double du=Math.random()*360;
        double x=Math.sin(du);
        double y=Math.cos(du);
        return new double[]{x_center+x*r,y_center+y*r};
    }

    public static void main(String[] args) {
        System.out.println(Arrays.toString(new Solution478(1, 0, 0).randPoint()));
    }
}
